#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>

int main()
{
	int fd = 0;
	char buf[1024] = {0};
	int ret = 0;

	fd = open("./exam.txt",O_RDONLY);
	if(fd == -1)
	{
		perror("open");
		exit(-1);
	}

	ret = read(fd,buf,1023);
	while(ret > 0)
	{
		printf("%s",buf);
		memset(buf,0,sizeof(buf));
		ret = read(fd,buf,1023);
	}

	close(fd);


	return 0;
}
